package com.mall.server.controller.oms;

import com.mall.model.domain.OmsOrderSetting;
import com.mall.model.vo.CommonResult;
import com.mall.server.service.oms.OmsOrderSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author : xyiaao
 * @createDate : 2022/4/2 19:49
 */
@CrossOrigin
@RestController
@RequestMapping("/orderSetting")
public class OmsOrderSettingController {

    @Autowired
    private OmsOrderSettingService omsOrderSettingService;


    /**
     * 修改指定订单设置
     *
     * @param id
     * @param omsOrderSetting
     * @return
     */
    @PostMapping("/update/{id}")
    public CommonResult update(@PathVariable("id") Long id, @RequestBody OmsOrderSetting omsOrderSetting) {

        omsOrderSettingService.update(id, omsOrderSetting);
        return CommonResult.success();
    }


    /**
     * 获取指定订单设置
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public CommonResult get(@PathVariable("id") Long id) {

        OmsOrderSetting omsOrderSetting = omsOrderSettingService.getById(id);
        return CommonResult.success(omsOrderSetting);
    }

}
